<?php /* Smarty version Smarty-3.1.6, created on 2018-05-28 17:12:04
         compiled from "D:/phpStudy/PHPTutorial/WWW/myshop/Home/View\IntegralGoods\goodsdetail.html" */ ?>
<?php /*%%SmartyHeaderCode:18271567955afe915a440b71-46925889%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'a2f885d9f30745f954da2cdca395d9869054cabe' => 
    array (
      0 => 'D:/phpStudy/PHPTutorial/WWW/myshop/Home/View\\IntegralGoods\\goodsdetail.html',
      1 => 1527498722,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '18271567955afe915a440b71-46925889',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.6',
  'unifunc' => 'content_5afe915a57a56',
  'variables' => 
  array (
    'good' => 0,
    'comments' => 0,
    'v' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5afe915a57a56')) {function content_5afe915a57a56($_smarty_tpl) {?><?php if (!is_callable('smarty_modifier_date_format')) include 'D:\\phpStudy\\PHPTutorial\\WWW\\ThinkPHP\\Library\\Vendor\\Smarty\\plugins\\modifier.date_format.php';
?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>商品详情页</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="<?php echo @PUBLIC_PATH;?>
css/amazeui.min.css"/>
<link rel="stylesheet" href="<?php echo @IMAGES_PATH;?>
style.css"/>
<script src="<?php echo @PUBLIC_PATH;?>
js/jquery.min.js"></script>
<script src="<?php echo @PUBLIC_PATH;?>
js/amazeui.min.js"></script>
<script>
	var goods=new Array();
function checkIsInteger(str)
{
  //如果为空，则通过校验
  if(str == "")
    return true;
     if(/^(\-?)(\d+)$/.test(str))
       return true;
     else
       return false;
}
var errordialog=function(c){
	alert(c)
}
//检验商品数量
function checkCounts(id) {
    var Counts = $("#" + id).val();
    if (Counts == "") {
        errordialog("请填写数量!");
        return false;
    }
    else if (!checkIsInteger(Counts)) {
        errordialog("商品数量不是整数!");
        return false;
    }
    else if (Counts < 1) {
        errordialog("商品数量不能小于1!");
        return false;
    }
    else {
        return true;
    }
}
function addQty(){
	checkCounts('txtQty');
	var qty = parseInt($('#txtQty').val());
	$('#txtQty').val(qty+1);
}
function subtractQty(){
	checkCounts('txtQty');
	var qty = parseInt($('#txtQty').val());
	if(qty <=1){
		errordialog("商品数量不能小于1");
		return;
	}
	$('#txtQty').val(qty-1);
}
</script>
<style type="text/css">
	.am-comment-main{
		margin-right: 20px !important;
	}
	.am-comment-main i{
		float: right;
		color:#f09513;
	}
	.am-avg-sm-4>li {
    	width: 33%;
	}
</style>
</head>

<body>
<div class="container">
	<!--引入头文件-->
	<?php echo $_smarty_tpl->getSubTemplate ("../header.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

	<script>$('.title-link').text("商品详情")</script>
	
    <!-- banner -->
    <div data-am-widget="slider" class="am-slider am-slider-a1" data-am-slider='{ &quot;directionNav&quot;:false}'>
      <ul class="am-slides">
        <li>
          <img src="<?php echo $_smarty_tpl->tpl_vars['good']->value['main_img'];?>
">
        </li>
        <!--<li>
          <img src="http://s.amazeui.org/media/i/demos/bing-2.jpg">
        </li>
        <li>
          <img src="http://s.amazeui.org/media/i/demos/bing-3.jpg">
        </li>
        <li>
          <img src="http://s.amazeui.org/media/i/demos/bing-4.jpg">
        </li>-->
      </ul>
    </div>
	<div class="gray-panel">
    	<div class="paoduct-title-panel">
        	<h1 class="product-h1"><?php echo $_smarty_tpl->tpl_vars['good']->value['name'];?>
</h1>
            <p><span class="am-fr product-title-gray-text"><i class="am-icon-star"></i>收藏</span><span class="bold">积分：</span><span class="red2">￥<?php echo $_smarty_tpl->tpl_vars['good']->value['price'];?>
</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="product-title-gray-text"></span></p>
        </div>
        <div class="my-search-title-panel">
        	<ul class="am-avg-sm-4 am-text-center am-text-sm">
            	<li class="am-text-center">销量<br /><?php echo $_smarty_tpl->tpl_vars['good']->value['salecount'];?>
件</li>
                <li class="am-text-center">库存<br /><?php echo $_smarty_tpl->tpl_vars['good']->value['count'];?>
件</li>
                <!--<li class="am-text-center">订单<br />0个</li>-->
                <li class="am-text-center">评价<br /><?php echo $_smarty_tpl->tpl_vars['good']->value['comment_cnt'];?>
条</li>
            </ul>
    	</div>
        <div class="my-search-title-panel">
            <hr data-am-widget="divider" style="" class="am-divider-default am-margin-bottom-sm"/>
            <p class="my-search-titp-p am-text-sm bold">数量</p>
            <div style="overflow:hidden">
            <form class="am-form-inline" role="form" action="<?php echo @__MODULE__;?>
/Order/makeorder" method="post">
            	<button type="button" class="am-btn am-btn-default" style="float:left" onClick="subtractQty();" ><i class="am-icon-minus"></i></button>
                <input type="number" name="goods[<?php echo $_smarty_tpl->tpl_vars['good']->value['id'];?>
][quantity]" id="txtQty" class="am-form-field txt-qty am-text-center am-text-sm" value="1" style=" width:60px; margin-right:0px; height:37px; display:inline; float:left">
                <button type="button" class="am-btn am-btn-default" style="float:left" onClick="addQty();"><i class="am-icon-plus"></i></button>
            
            	<p><input name="goods[<?php echo $_smarty_tpl->tpl_vars['good']->value['id'];?>
][id]" value="<?php echo $_smarty_tpl->tpl_vars['good']->value['id'];?>
" style="display: none;"> </p>
              <p><input name="goods[<?php echo $_smarty_tpl->tpl_vars['good']->value['id'];?>
][name]" value="<?php echo $_smarty_tpl->tpl_vars['good']->value['name'];?>
" style="display: none;"> </p>
              <p><input name="goods[<?php echo $_smarty_tpl->tpl_vars['good']->value['id'];?>
][price]" value="<?php echo $_smarty_tpl->tpl_vars['good']->value['price'];?>
" style="display: none;"> </p>
              <p><input name="goods[<?php echo $_smarty_tpl->tpl_vars['good']->value['id'];?>
][main_img]" value="<?php echo $_smarty_tpl->tpl_vars['good']->value['main_img'];?>
" style="display: none;"> </p>
            </form>
            </div>
            <hr data-am-widget="divider" style="" class="am-divider-default am-margin-bottom-sm"/>
            <div>
            	<ul class="am-avg-sm-2 am-text-center">
                	<li class="am-text-center am-padding-sm"><button type="button" data-id="<?php echo $_smarty_tpl->tpl_vars['good']->value['id'];?>
" class="am-btn am-btn-success am-btn-block am-radius addshopcart">加入购物车</button></li>
                    <li class="am-text-center am-padding-sm"><a ><button type="button" class="am-btn am-btn-danger am-btn-block am-radius makeorder">立即购买</button></a></li>
                </ul>
            </div>
        </div>
        <div class="paoduct-title-panel">
        	<h2 class="product-h1">商家信息</h2>
            <p><span class="am-fr product-title-gray-text"><a href="tel:88888888" class=" am-text-success"><i class="am-icon-phone"></i> 电话联系</a></span><span class="product-title-gray-text"><i class="am-icon-crosshairs"></i> 平区回笼观黄平路19号</span></p>
            <hr data-am-widget="divider" style="" class="am-divider-default am-margin-bottom-sm"/>
            <div style="overflow:hidden">
            <!--<ul class="am-avg-sm-2 am-text-center am-padding-bottom-sm">
            	<li class="am-text-center"><a href="#"><i class="am-icon-bank"></i> 进店逛逛</a></li>
                <li class="am-text-center"><a href="#"><i class=" am-icon-comments"></i> 联系卖家</a></li>
            </ul>-->
            </div>
        </div>
    </div>
            <!-- 商品详情 -->
        
        <div data-am-widget="tabs" class="am-tabs am-tabs-d2">
          <ul class="am-tabs-nav am-cf">
            <li class="am-active">
              <a href="[data-tab-panel-0]">详情</a>
            </li>
            <!--<li class="">
              <a href="[data-tab-panel-1]">交易记录</a>
            </li>-->
            <li class="">
              <a href="[data-tab-panel-2]">评价</a>
            </li>
          </ul>
          <div class="am-tabs-bd">
            <div data-tab-panel-0 class="am-tab-panel am-active"><?php echo $_smarty_tpl->tpl_vars['good']->value['detail'];?>
</div>
            <div data-tab-panel-1 class="am-tab-panel ">
            
            <ul class="am-comments-list am-comments-list-flip">
            <?php  $_smarty_tpl->tpl_vars['v'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['v']->_loop = false;
 $_smarty_tpl->tpl_vars['k'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['comments']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['v']->key => $_smarty_tpl->tpl_vars['v']->value){
$_smarty_tpl->tpl_vars['v']->_loop = true;
 $_smarty_tpl->tpl_vars['k']->value = $_smarty_tpl->tpl_vars['v']->key;
?>
            <li class="am-comment">
              <a >
                <img class="am-comment-avatar" src="<?php echo $_smarty_tpl->tpl_vars['v']->value['touxiang'];?>
" alt=""/> <!-- 头像 -->
              </a>
            
              <div class="am-comment-main">
                <header class="am-comment-hd">
                  <div class="am-comment-meta">
                  	<time datetime="2013-07-27T04:54:29-07:00" title="最后的通信时间" class="am-fr"><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['v']->value['create_time'],'%Y-%m-%d %H:%M:%S');?>
</time>
                    <a  class="am-comment-author"><?php echo $_smarty_tpl->tpl_vars['v']->value['user_name'];?>
</a>
					<?php $_smarty_tpl->tpl_vars['star'] = new Smarty_Variable;$_smarty_tpl->tpl_vars['star']->step = 1;$_smarty_tpl->tpl_vars['star']->total = (int)ceil(($_smarty_tpl->tpl_vars['star']->step > 0 ? 5-$_smarty_tpl->tpl_vars['v']->value['score']+1 - (1) : 1-(5-$_smarty_tpl->tpl_vars['v']->value['score'])+1)/abs($_smarty_tpl->tpl_vars['star']->step));
if ($_smarty_tpl->tpl_vars['star']->total > 0){
for ($_smarty_tpl->tpl_vars['star']->value = 1, $_smarty_tpl->tpl_vars['star']->iteration = 1;$_smarty_tpl->tpl_vars['star']->iteration <= $_smarty_tpl->tpl_vars['star']->total;$_smarty_tpl->tpl_vars['star']->value += $_smarty_tpl->tpl_vars['star']->step, $_smarty_tpl->tpl_vars['star']->iteration++){
$_smarty_tpl->tpl_vars['star']->first = $_smarty_tpl->tpl_vars['star']->iteration == 1;$_smarty_tpl->tpl_vars['star']->last = $_smarty_tpl->tpl_vars['star']->iteration == $_smarty_tpl->tpl_vars['star']->total;?>
                    	<i class="am-icon-star-o " ></i>
					<?php }} ?>
                    <?php $_smarty_tpl->tpl_vars['star'] = new Smarty_Variable;$_smarty_tpl->tpl_vars['star']->step = 1;$_smarty_tpl->tpl_vars['star']->total = (int)ceil(($_smarty_tpl->tpl_vars['star']->step > 0 ? $_smarty_tpl->tpl_vars['v']->value['score']+1 - (1) : 1-($_smarty_tpl->tpl_vars['v']->value['score'])+1)/abs($_smarty_tpl->tpl_vars['star']->step));
if ($_smarty_tpl->tpl_vars['star']->total > 0){
for ($_smarty_tpl->tpl_vars['star']->value = 1, $_smarty_tpl->tpl_vars['star']->iteration = 1;$_smarty_tpl->tpl_vars['star']->iteration <= $_smarty_tpl->tpl_vars['star']->total;$_smarty_tpl->tpl_vars['star']->value += $_smarty_tpl->tpl_vars['star']->step, $_smarty_tpl->tpl_vars['star']->iteration++){
$_smarty_tpl->tpl_vars['star']->first = $_smarty_tpl->tpl_vars['star']->iteration == 1;$_smarty_tpl->tpl_vars['star']->last = $_smarty_tpl->tpl_vars['star']->iteration == $_smarty_tpl->tpl_vars['star']->total;?>
                    	<i class="am-icon-star" ></i>
					<?php }} ?>
                  </div>
                </header>
                <div class="am-comment-bd am-text-sm">
                  <?php echo $_smarty_tpl->tpl_vars['v']->value['content'];?>

                </div>
              </div>
            </li>
            <?php } ?>
        </ul>
            
            </div>
          <div data-tab-panel-2 class="am-tab-panel ">
<div class="am-cf am-padding-sm" >
    	<ul class="am-comments-list am-comments-list-flip">
            <li class="am-comment">
              <a href="">
                <img class="am-comment-avatar" src="<?php echo @IMAGES_PATH;?>
img1.jpg" alt=""/> <!-- 头像 -->
              </a>
            
              <div class="am-comment-main">
                <header class="am-comment-hd">
                  <div class="am-comment-meta">
                    <a href="#link-to-user" class="am-comment-author">昵称</a>（他的用户名）
                    <time datetime="2013-07-27T04:54:29-07:00" title="最后的通信时间" class="am-fr">2014-7-12 15:30</time>
                  </div>
                </header>
                <div class="am-comment-bd am-text-sm">
                  那，那是一封写给南部母亲的信。我茫然站在骑楼下，我又看到永远的樱子走到街心。
                </div>
              </div>
            </li>
            <li class="am-comment">
              <a href="">
                <img class="am-comment-avatar" src="<?php echo @IMAGES_PATH;?>
img1.jpg" alt=""/> <!-- 头像 -->
              </a>
            
              <div class="am-comment-main">
                <header class="am-comment-hd">
                  <div class="am-comment-meta">
                    <a href="#link-to-user" class="am-comment-author">昵称</a>（他的用户名）
                    <time datetime="2013-07-27T04:54:29-07:00" title="最后的通信时间" class="am-fr">2014-7-12 15:30</time>
                  </div>
                </header>
                <div class="am-comment-bd am-text-sm">
                  其实雨下得并不大，却是一生一世中最大的一场雨。而那封信是这样写的，年轻的樱子知不知道呢？
                </div
              ></div>
            </li>
            <li class="am-comment"><!-- 头像显示在右手边 am-comment-flip -->
              <a href="">
                <img class="am-comment-avatar" src="<?php echo @IMAGES_PATH;?>
img1.jpg" alt=""/> <!-- 头像 -->
              </a>
            
              <div class="am-comment-main">
                <header class="am-comment-hd">
                  <div class="am-comment-meta">
                    <a href="#link-to-user" class="am-comment-author">昵称</a>（他的用户名）
                    <time datetime="2013-07-27T04:54:29-07:00" title="最后的通信时间" class="am-fr">2014-7-12 15:30</time>
                  </div>
                </header>
                <div class="am-comment-bd  am-text-sm">
                  She's gone 我早知道
                </div>
              </div>
            </li>
        </ul>
    </div>
          </div>
        </div>
        </div>
    
    
    
    <footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
        <hr data-am-widget="divider" style="" class="am-divider am-divider-default"/>
      <div class="am-footer-miscs ">
        <p>CopyRight©2014 AllMobilize Inc.</p>
        <p>京ICP备13033158</p>
      </div>
    </footer>
    <!--底部-->
    <?php echo $_smarty_tpl->getSubTemplate ("../footer.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

</div>
<script type="text/javascript">
	$('.makeorder').click(function(){
		//登录后才可以购买
		<?php if ($_SESSION['id']==null){?>
			window.location.href="<?php echo @__MODULE__;?>
/User/integrallogin";
			return;
		<?php }?>
	$("form").submit();	
})
	$('.addshopcart').click(function(){
		//登录后才可以添加购物车
		<?php if ($_SESSION['id']==null){?>
			window.location.href="<?php echo @__MODULE__;?>
/User/integrallogin";
			// window.navigate("myshop/index.php/User/integrallogin.html");
		<?php }?>
		var thisgoods=$(this);
		var data={
			id:thisgoods.data('id'),
		}
		$.post("<?php echo @__CONTROLLER__;?>
/addshopcart", data, function(ret){
			console.log(ret);
			if(ret){
//				thisgoods.removeClass('am-icon-star-o');
				alert("加入购物车成功");
			}else{
//				thisgoods.addClass('am-icon-star-o');
				alert("加入购物车失败");
			}
		})
	})
</script>
</body>
</html>
<?php }} ?>